import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import {render} from "@apps/antd-admin/src/hooks/render/renderUtils";
import {RenderType} from '@pkg/setting';
import {Api} from "./api";
export const columns: BasicColumn[] = [
  {
    title: '服务项目',
    dataIndex: 'serviceNames',
    width: 180,
    customRender: render.renderTxt,
  },
  {
    title: '类别',
    dataIndex: 'serviceType',
    dictCode: 'loveService',
    customRender: render.renderDict,
    width: 100,
  },
  {
    title: '联系人',
    dataIndex: 'linkMan',
    width: 100,
  },
  {
    title: '联系电话',
    dataIndex: 'mobile',
    width: 100,
  },
  {
    title: '服务对象',
    dataIndex: 'serviceObj',
    width: 100,
    dictCode: 'serviceObj',
    renderType: RenderType.DICT,
  },
  {
    title: '预约时间',
    dataIndex: 'reservationDate',
    width: 100,
  },
  {
    title: '航班号',
    dataIndex: 'flightNo',
    width: 100,
  },
  {
    title: '航班类型',
    dataIndex: 'flightType',
    width: 100,
    dictCode: 'flightType',
    renderType: RenderType.DICT,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 100,
  },
  {
    title: '状态',
    dataIndex: 'state',
    width: 120,
    dictData: [
      { label: '已取消', value: 0, color: '#a6a9a6' },
      { label: '已预约', value: 1, color: '#09d550' },
      { label: '待领取', value: 2, color: '#9f2550' },
      { label: '已完成', value: 3, color: '#fd3850' },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'serviceNames',
    label: '服务项目',
    component: 'Input',
    colProps: { span: 3 },
  },
  {
    field: 'linkMan',
    label: '联系人',
    component: 'Input',
    colProps: { span: 3 },
  },
  {
    field: 'state',
    label: '状态',
    component: 'Select',
    colProps: {span: 3},
    componentProps: {
      options: [
        { label: '已取消', value: 0, color: '#a6a9a6' },
        { label: '已预约', value: 1, color: '#09d550' },
        { label: '待领取', value: 2, color: '#9f2550' },
        { label: '已完成', value: 3, color: '#fd3850' },
      ],
    }
  }
];

export const formSchema: FormSchema[] = [
  {
    label: '',
    field: 'loveId',
    component: 'Input',
    show: false,
  },
  {
    label: '服务项目',
    field: 'serviceNames',
    component: 'Input',
    required: true,
  },
  {
    field: 'linkMan',
    label: '联系人',
    component: 'Input',
  },
  {
    field: 'mobile',
    label: '联系电话',
    component: 'Input',
  },
  {
    label: '预约日期',
    field: 'reservationDate',
    component: 'DatePicker',
    required: true,
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    label: '服务对象',
    field: 'serviceObj',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      dictCode: 'serviceObj',
    },
  },
  {
    label: '航班号',
    field: 'flightNo',
    component: 'Input',
  },
  {
    label: '航班类型',
    field: 'flightType',
    component: 'ApiSelect',
    componentProps: {
      api: Api.listByDictType,
      labelField: 'dicDataTitle',
      valueField: 'dicDataValue',
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
];
